<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE html>
<html>
  <head>
    
    <title>增加分类</title>
    <%@include file="../header.jsp" %>

  </head>
 	 <body>
 	 	<%@include file="top.jsp" %>
 	 
		<div class="container-fluid">
			<div class="row-fluid">
				<form action="admin_addCategory.action" class="form-horizontal" method="POST">
				  <s:hidden name="pcategory.id"></s:hidden>
				  <fieldset>
				    <legend>创建新分类</legend>
				    <div class="control-group">
				      <label class="control-label" for="input01">父分类:</label>
				      <div class="controls">
				        <s:textfield name="pcategory.name" readonly="true"></s:textfield>
				      </div>
				    </div>
				    <div class="control-group">
				      <label class="control-label" for="input01">名称:</label>
				      <div class="controls">
				        <s:textfield id="name" name="category.name" cssClass="input-control"></s:textfield>
				         <p class="help-block">中文长度不超过6个字,字母不超过20个</p>
				      </div>
				    </div>
				     <div class="control-group">
				      <label class="control-label" for="input01">描述:</label>
				      <div class="controls">
				       <s:textarea id="description" name="category.description"></s:textarea>
				       <p class="help-block">长度不超过30个字</p>
				      </div>
				    </div>
				    
				    
				    
				  </fieldset>
				  
				</form>
			</div>
			
			<div class="row">
				<div class="span2 offset2">
					<button class="btn btn-success" onclick="doSubmit()">确定</button>
					
				</div>
				<div class="span1">
					<button class="btn btn-danger" onclick="history.go(-1)">取消</button>
				</div>
			</div>
			
				
		</div>

		<script>
			function doSubmit(){
				var name = $('#name').val();
				if(name.length <2){
					alert('分类名词起码两个字');
					$('#name').focus();
					return false;
				}
				var description = $('#description').val();
				if(description.length <2){
					alert('分类描述起码写一点吧?啊?');
					$('#description').focus();
					return false;
				}

				//提交表单
				document.forms[0].submit();
			}
		</script>
 		 
	</body>
</html>
